package com.ffapp.demo.chat.model;


import com.ffapp.demo.bean.BaseListBeanXF;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;

import my.TimeUtils;

public class ChatMsgListBean extends BaseListBeanXF {

    public final static int ONE_PAGE_SIZE = 40;

    private ArrayList<ChatMsgListData> list = new ArrayList<ChatMsgListData>();

    public ArrayList<ChatMsgListData> getList() {
        return list;
    }

    public void setList(ArrayList<ChatMsgListData> list) {
        this.list = list;
    }

    public boolean isHasMoreTop(){
        if(list == null)return false;
        return (list.size() >= ONE_PAGE_SIZE);
    }

    public void sortByCreateTime(){
        Collections.sort(list, new Comparator<ChatMsgListData>() {
            @Override
            public int compare(ChatMsgListData o1, ChatMsgListData o2) {
                return TimeUtils.DateCompare(o1.getCreateTime(),o2.getCreateTime(),TimeUtils.TIME_FOMART);
            }
        });
//        list.sort(new ChatMsgComparator());
    }


}
